<template>
  <div class="app-container">
    <el-card class="mt10">
      <el-form
        :model="queryParams"
        ref="queryForm"
        :inline="true"
        label-width="auto"
        size="small"
        class="ry_form">
        <el-form-item label="商品名称" prop="goodsName">
          <el-input size="small" placeholder="请输入商品名称"/>
        </el-form-item>
        <el-form-item label="计划发货日期" prop="Time">
          <el-date-picker
            v-model="queryParams.Time"
            type="datetimerange"
            :picker-options="pickerOptions"
            range-separator="至"
            size="small"
            format="yyyy-MM-dd HH:mm:ss"
            value-format="yyyy-MM-dd HH:mm:ss"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
            :default-time="['00:00:00', '23:59:59']"
            align="right"
            @change="handleChange">
          </el-date-picker>
        </el-form-item>
        <el-form-item class="flex_one tr">
          <el-button type="primary" icon="el-icon-search" size="small" @click="handleQuery">查询</el-button>
          <el-button icon="el-icon-refresh" size="small" @click="resetQuery">重置</el-button>
        </el-form-item>
      </el-form>
    </el-card>
    <el-card class="mt10">
      <el-descriptions
        :column="2"
        border
        :label-style="{ width: '100px' }">
        <el-descriptions-item label="商品名称">西兰花鲜肉套餐</el-descriptions-item>
        <el-descriptions-item label="待发货数量">100</el-descriptions-item>
        <el-descriptions-item label="商品名称">西兰花鲜肉套餐</el-descriptions-item>
        <el-descriptions-item label="待发货数量">100</el-descriptions-item>
        <el-descriptions-item label="商品名称">西兰花鲜肉套餐</el-descriptions-item>
        <el-descriptions-item label="待发货数量">100</el-descriptions-item>
        <el-descriptions-item label="商品名称">西兰花鲜肉套餐</el-descriptions-item>
        <el-descriptions-item label="待发货数量">100</el-descriptions-item>
        <el-descriptions-item label="商品名称">西兰花鲜肉套餐</el-descriptions-item>
        <el-descriptions-item label="待发货数量">100</el-descriptions-item>
        <el-descriptions-item label="商品名称">西兰花鲜肉套餐</el-descriptions-item>
        <el-descriptions-item label="待发货数量">100</el-descriptions-item>
        <el-descriptions-item label="商品名称">西兰花鲜肉套餐</el-descriptions-item>
        <el-descriptions-item label="待发货数量">100</el-descriptions-item>
      </el-descriptions>
    </el-card>
  </div>
</template>

<script>
import dateUtil from '@/utils/DateUtil';
import { mapGetters } from "vuex";

export default {
  computed:{ ...mapGetters(['userId']) },
  data() {
    return {
      // 遮罩层
      loading: false,
      // 时间配置
      pickerOptions: {
        shortcuts: dateUtil.getTimeShort2()
      },
      // 总条数
      total: 0,
      // 订单表表格数据
      orderList: [],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        goodsName: null,
        Time: [],
        startTime: null,
        endTime: null
      }
    };
  },
  async created() {
    this.getList()
  },
  methods: {
    /** TODO 查询订单表列表 */
    getList() {
      if (this.queryParams.Time) {
        this.queryParams.startTime = this.queryParams.Time[0]
        this.queryParams.endTime = this.queryParams.Time[1]
      }
    },
    /** 搜索按钮操作 TODO */
    handleQuery() {
      // this.queryParams.pageNum = 1;
      // this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },

    // 时间搜索条件change方法
    handleChange(value) {
      if (!value) {
        this.queryParams.startTime = null;
        this.queryParams.endTime = null;
      }
    }
  }
};
</script>
